package com.example.demo.controller;

import cn.com.tcsl.keygen.KeyGenManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class KeyGenerator {

    @Autowired
    KeyGenManager keyGenManager;

    //自定义业务类型和主键生成器映射关系的使用方式
    @GetMapping("/keyGen")
    public String getKeyGenByCustomized() {
        for (int i = 0; i < 2; i++) {
            System.out.println("----第" + (i + 1) + "轮获取ID开始");
            long key = keyGenManager.getLongKey();
            System.out.println("key-----" + key);
        }
        return "success";
    }


}
